<%--
  Created by IntelliJ IDEA.
  User: Aurora
  Date: 2022/4/8
  Time: 8:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>图书信息管理系统</title>
    <link href="${pageContext.request.contextPath}/static/list.css" rel="stylesheet" type="text/css"/>
</head>
<body>
    <div class="select">
        <form method="post" action="${pageContext.request.contextPath}/show?currentPage=1">
            <select id="key" name="key">
                <option>书名</option>
                <option>作者</option>
                <option>出版社</option>
            </select>
            <input id="value" name="value">
            <button type="submit">提交</button>
        </form>
    </div>

    <table>
        <a class="add" href="#">添加新书</a>
        <tr class="head">
            <th>书名</th><th>作者</th><th>出版社</th><th>页数</th><th>价格</th>
        </tr>
        <c:forEach var="books" items="${books}">
            <tr>
                <td>${books.bookName}</td>
                <td>${books.bookAuthor}</td>
                <td>${books.bookPublish}</td>
                <td>${books.bookPage}</td>
                <td>${books.bookPrice}</td>
            </tr>
        </c:forEach>
    </table>
    <p class="page">
        <%
            String key = request.getParameter("key");
            String value = request.getParameter("value");
        %>
        <a href="${pageContext.request.contextPath}/show?currentPage=1&key=<%=key %>&value=<%=value %>">
            <button>首页</button>
        </a>
        <a href="${pageContext.request.contextPath}/show?currentPage=${page.currPageNo-1}&key=<%=key %>&value=<%=value %>">
            <button>上一页</button>
        </a>
        <a href="${pageContext.request.contextPath}/show?currentPage=${page.currPageNo+1}&key=<%=key %>&value=<%=value %>">
            <button>下一页</button>
        </a>
        <a href="${pageContext.request.contextPath}/show?currentPage=${page.totalPage}&key=<%=key %>&value=<%=value %>">
            <button>末页</button>
        </a>
        <a>
            第${page.currPageNo}页/共${page.totalPage}页
        </a>
    </p>
</body>
</html>
